package xyx.ysfwpt.dao;

import com.sun.org.apache.xpath.internal.operations.Or;
import org.apache.ibatis.annotations.Param;
import xyx.ysfwpt.model.Order;
import xyx.ysfwpt.model.OrderDetail;

import java.util.List;
import java.util.Map;

public interface OrderDao {

    List<Order> selectAllOrder();  //查询所有订单

    //根据输入框信息查询
    List<Order> selectOrderByInputList(@Param(value = "user_id") int user_id,  //该订单负责医生的编号，等同于工号
                                       @Param(value = "user_type") String user_type,  //该医生的类型（权限）
                                       @Param(value = "hospital") String hospital,  //医院
                                       @Param(value = "user_department") String user_department,  //医生（该订单）所属科室
                                       @Param(value = "state") Integer state,  //订单状态
                                       @Param(value = "source") String source,  //订单来源
                                       @Param(value = "type") Integer type,  //订单类型（1:自取/2:配送）
                                       @Param(value = "searchword") String searchword,  //查询词
                                       @Param(value = "timefrom") String timefrom,
                                       @Param(value = "timeto") String timeto,
                                       @Param(value = "isDirector") String isDirector,
                                       @Param(value = "department") String department);

    List<OrderDetail> selectMedicineByOrderId(String order_id);  //根据订单编号查询订单所含药品

    Order selectOrderDetailByOrderId(String order_id);  //根据订单编号查询订单所有信息

    void updateOrderState(@Param(value = "order_id") String order_id,
                          @Param(value = "state") Integer state,
                          @Param(value = "reason_name") String reason_name,
                          @Param(value = "reason") String reason);  //订单状态修改（根据订单编号修改订单状态，并写入修改订单状态的理由）

    void updateOrderExpress(@Param(value = "order_id") String order_id,
                            @Param(value = "express_company_name") String express_company_name,
                            @Param(value = "express_price") float express_price,
                            @Param(value = "express_id") String express_id);  //订单快递信息修改（根据订单编号写入快递公司名称，快递费用，快递单号）

    List<Map> selectOrderAmountByYear(@Param(value = "yearfrom") String yearfrom,
                                      @Param(value = "yearto") String yearto,
                                      @Param(value = "type") String type);  //根据年份、订单类别（在线、自取）查询全年各类订单数量

    //根据订单类别（在线、自取）查询订单总数、已完成订单数量、订单总金额、药品总金额、快递总金额
    Map selectOrderAmountAndMoney1(@Param(value = "timefrom") String timefrom,
                                   @Param(value = "timeto") String timeto);

    Map selectOrderAmountAndMoney2(@Param(value = "timefrom") String timefrom,
                                   @Param(value = "timeto") String timeto);


    //根据订单类别（在线、自取）查询每天订单总数、已完成订单数量、订单总金额、药品总金额、快递总金额
    List<Map> selectOrderByDay0(@Param(value = "timefrom") String timefrom,
                                @Param(value = "timeto") String timeto);

    List<Map> selectOrderByDay1(@Param(value = "timefrom") String timefrom,
                                @Param(value = "timeto") String timeto);

    List<Map> selectOrderByDay2(@Param(value = "timefrom") String timefrom,
                                @Param(value = "timeto") String timeto);
}
